<template>
	<div>
		<el-form 
		:model="form" 
		:rules="rules" 
		ref="from" 
		label-width="120px" 
		class="ruleForm">
			<el-form-item 
			required 
			class='activity-type form-item' 
			label="活动类型:">
				<el-radio-group 
				v-model="form.type"
				@change='handleGetDelivery'>
				    <el-radio class="type" :label="0">普通活动(非会员)</el-radio>
	  				<el-radio class="type" :label="1">会员活动</el-radio>
  				</el-radio-group>
  			</el-form-item>
  			<el-form-item 
  			required 
  			class='form-item' 
  			label="需要报名:">
			    <el-switch 
			    class='is-entry' 
			    v-model="form.delivery">
			    </el-switch>
			</el-form-item>
			<div v-show='form.delivery ? true : false'>
			<div class="showInformation form-item">
				<el-form-item class='info'>
					<div class="person-info">
						报名人信息（默认表单只要求输入姓名、手机号):
					</div>
				</el-form-item>
				<el-table
			    :data="tableCheckedOptions"
			    style="width: 100%">
			      <el-table-column
			        prop="name"
			        label="名称"
			        width="180">
			        <template scope="scope">
			        	<span style="text-align:center">{{ scope.row.infoname}}</span>
			        </template>
			      </el-table-column>
			      <el-table-column
			        prop="attribute"
			        label="属性"
			        width="180">
			        <template scope="scope">
			        	<span style="text-align:center">{{scope.row.key}}</span>
			        </template>
			      </el-table-column>
			      <el-table-column
			        prop="is_must"
			        label="是否必填">
			        <template scope="scope">
			        	<span style="text-align:center">
			        		<el-checkbox :disabled='scope.row.infoname =="姓名"||scope.row.infoname == "手机号"' v-model="scope.row.mustStatus"></el-checkbox>
			        	</span>
			        </template>
			      </el-table-column>
			      <el-table-column
			      fixed="right"
			      label="操作"
			      width="120">
			      <template scope="scope">
			        <el-button
			         v-show='scope.row.infoname =="姓名"? false : true'
			         v-if='scope.row.infoname == "手机号"? false : true'
			          @click.native.prevent="deleteRow(scope.$index, tableCheckedOptions)"
			          type="text"
			          size="small">
			          移除
			        </el-button>
			      </template>
			    </el-table-column>
			    </el-table>
			</div>
			<div>
				<el-form-item class='form-item'>
					<div class="person-info">报名设置-选择想展示的报名字段:</div>
					<div class="normal-field">
						<div class="often-use">常用字段</div>
						<el-form-item class='type-container'>
							<el-button
							  v-for="(tag,index) in commonlist"
							  :key="tag.id"
							  ref='tag_name'
							  :disabled='tag.infoname !="手机号" && tag.infoname !="姓名" && tag.backflag != 1 ? false :true'
							  class='tag-name'
							  @click="handleClose(index)"
							>{{tag.infoname}}</el-button>
						    <el-button type="primary" class='self-btn' @click='handleBtnSelf'>自定义</el-button>
						    <div v-if="inputVisible">
						    <el-input
							  class="input-new-tag self-input"
							  v-model="inputNameValue"
							  placeholder='自定义字段'
							>
							</el-input>
							<el-button class='confirm-btn' type="primary" @click='confrimBtn'>确定</el-button>	
							</div>	
						</el-form-item>
					</div>
				</el-form-item>
			</div>
			<el-form-item class='comment form-item' label="开启评论:">
			    <el-switch 
			    class='is-entry' 
			    @change='handleCommentSwitch' 
			    v-model="form.comment">
			    </el-switch>
			</el-form-item>
			<el-form-item class='form-item' label="开启评论审核:">
			    <el-switch 
			    class='is-entry' 
			    @change='handleSwitch' 
			    v-model="form.review">
			    </el-switch>
			</el-form-item>
			<el-form-item 
			class='comment form-item' 
			style='position:relative' 
			label="报名设置-购票券:">
			<br>
			<el-form-item 
			required 
			class='form-ticket-type' 
			label="票种类型:">
				<el-radio-group 
				v-model="form.tickettype" 
				@change='handleGetTicketType'>
				    <el-radio class="type" :label="0">票券整个时间段内有效</el-radio>
	  				<el-radio class="type" :label="1">票券仅限当天时间段有效</el-radio>
  				</el-radio-group>
  			</el-form-item>
			<el-table
			    :data="ticketlist"
			    :key='ticketlist.index'
			    border
			    style="width: 650px;margin-top:10px;">
			    <el-table-column
			      label="券(票)种"
			      width="100px">
			      <template scope="scope">
			        <span style="text-align:center">{{ scope.row.ticketTitle}}</span>
			      </template>
			    </el-table-column>
			    <el-table-column
			      label="价格"
			      width="100px">
			      <template scope="scope">
			        <span style="text-align:center">{{ scope.row.chargeType == 0 ? '免费':'收费'}}</span>
			      </template>
			    </el-table-column>
			    <el-table-column
			      label="每人最多购买"
			      width="100px">
			      <template scope="scope">
			        <span style="text-align:center">{{ scope.row.partmax}}</span>
			      </template>
			    </el-table-column>
			    <el-table-column
			      label="是否审核"
			      width="100px">
			      <template scope="scope" width="120px">
			        <span style="text-align:center">{{ scope.row.auditStatus == 0 ? '否' : '是'}}</span>
			      </template>
			    </el-table-column>
			    <el-table-column label="操作">
			      <template scope="scope" width="200px">
			        <el-button class='table-btn'
			          size="small"
			          @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
			        <el-button class='table-btn'
			          size="small"
			          type="danger"
			          @click="handleDeleteTableData(scope.$index)">删除</el-button>
			      </template>
			    </el-table-column>
			  </el-table>
			  </el-form-item>
			   	<el-button class='new-ticket set-btn' @click='handleTicketType'>新建票种</el-button>
			   	<div class="build-tickt" v-show='isShowTicket'>
			   		<div class="build-tickt-title">新建/编辑券（票）种</div>
					<el-form class='ticket-info' :model="created_form" ref="ruleForm" label-width="120px">
						<el-form-item required label="是否审核:">
							<el-radio-group v-model="created_form.auditStatus">
							    <el-radio class="type"  :label="1">是</el-radio>
				  				<el-radio class="type"  :label="0">否</el-radio>
			  				</el-radio-group>
	  					</el-form-item>
					  	<el-form-item required label="票种名称">
					    	<el-input v-model="created_form.ticketTitle" placeholder='儿童票'></el-input>
					  	</el-form-item>
				  		<el-form-item required label="费用类型">
					    	<el-select  
					    	v-model="created_form.chargeType" 
					    	@change='handlePriceType'>
					      		<el-option 
					      		v-for='price in pricelist' 
					      		:label="price.name" 
					      		:value="price.status" 
					      		:key='price.status'>
					      		</el-option>
					    	</el-select>
				  		</el-form-item>
						<el-form-item required label="票种说明">
						    <el-input type="textarea" v-model="created_form.remark"></el-input>
						</el-form-item>
				  		<el-form-item required label="每人最多购买">
				    		<el-input type="text" v-model="created_form.partmax"></el-input>
				 		</el-form-item>
				 		<el-form-item v-show='created_form.chargeType!=0' required label="费用">
				 			<div v-show='form.type == 0' v-for='(normal_item,index) in created_form.limitlist' >
				 				<span>所有卡级</span>
				      			<span>
				      				<el-input 
				      				type="text" 
				      				v-model='normal_item.score'  
				      				@change='handleInputChangeScore(index)'  
				      				class='reduce-money'>
				      				</el-input>
				      			</span>
				      			<span>积分</span>	
				      			<span>
				      				<el-input 
				      				type="text" 
				      				@change='handleInputChangeMoney(index)' 
				      				v-model='normal_item.money' 
				      				class='reduce-money'>
				      				</el-input>
				      			</span>
						      	<span>元</span>
						      	<em>(免费票请填0)</em>
				 			</div>
				 			<div v-show='form.type == 1'>
				    			<el-radio-group v-model="created_form.type"  @change='handleGetType'>
				      				<div>
				      					<el-radio 
				      					:label='0' 
				      					class='el-radio-choose'>统一扣减(不分卡级统一扣减积分或扣费)
					      				</el-radio>
					      			</div>
				      				<div 
				      				v-for='(normal_item,index) in created_form.limitlist' 
				      				v-if='index==0' 
				      				v-show='created_form.type == "0"' 
				      				class="normal-reduce">
				      					<span>所有卡级</span>
				      					<span>
				      						<el-input 
				      						v-model='normal_item.score'  
				      						@change='handleInputChangeScore(index)'  
				      						type="text" class='reduce-money'>
				      						</el-input>
				      					</span>
				      					<span>积分</span>	
				      					<span>
				      						<el-input 
				      						type="text" 
				      						@change='handleInputChangeMoney(index)' 
				      						v-model='normal_item.money' 
				      						class='reduce-money'>
				      						</el-input>
				      					</span>
				      					<span>元</span><em>(免费票请填0)</em>
				      				</div>
				      				<div>
				      					<el-radio 
				      					:label="1" 
				      					class='el-radio-choose'>
						      				尊享扣减（分卡级扣减积分设置价格）
						      			</el-radio>
				      					<div v-show='created_form.type == "1"'>
				      		 				<el-form-item 
				      		 				:inline='true' 
				      		 				prop="card_type" 
				      		 				class='custom-reduce'  
				      		 				v-for='(item1,index) in created_form.limitlist' 
				      		 				:key='item1[index]'>
						    					<el-select 
						    					style='display:inline-block' 
						    					placeholder='请选择卡的类型' 
						    					@change='getCardType(index,$event)' 
						    					class='reduce-money' 
						    					v-model="item1.cardname">
						      						<el-option 
						      						v-for='card in limitlist' 
						      						:key="card.cardtype" 
						      						:label="card.cardname" 
						      						:value="card.cardname">
						      						</el-option>
						    					</el-select>
						    					<span>
						    						<el-input 
						    						v-model='item1.score'  
						    						@change='handleInputChangeScore(index)'  
						    						class='reduce-money' 
						    						type="text">
						    						</el-input>
						    					</span>
				      							<span>积分</span>	
				      							<span>
				      								<el-input 
				      								class='reduce-money' 
				      								@change='handleInputChangeMoney(index)' 
				      								v-model='item1.money'
				      								type="text">
				      								</el-input>
				      							</span>
				      							<span>元</span>
				      							<span>
				      								<span @click='addDiscount($event,index)'>
				      									<i class="el-icon-plus change-num" 
				      									v-show='item1.backflag == 0 ? true : false'></i>
				      								</span>
					      							<span>
					      								<i class="el-icon-minus change-num" @click='reduceDiscount($event,index)' v-show='item1.backflag == 0 ? false : true'>
					      								</i>
					      							</span>
				      							</span>
						  					</el-form-item>
						  				</div>
				      				</div>
				    			</el-radio-group>
							</div>
				  		</el-form-item>
						<el-form-item 
						required 
						label='活动日期'>
					  		<div 
					  		style='margin-bottom:40px' 
					  		v-for='(item,index) in created_form.datelist' 
					  		:key='item.index'>
						  		<div class='date-range'>
						           	<el-date-picker
								      v-model="item.startDate"
								      class='date-range-item'
								      :picker-options="pickerOptions0"
								      type="date"
								      placeholder="选择日期">
								    </el-date-picker>
								    <el-date-picker
								      v-model="item.endDate"
								      class='date-range-item'
								      :picker-options="pickerOptions0"
								      type="date"
								      placeholder="选择日期">
								    </el-date-picker>
						          	<div>
							          	<el-button 
							          	type="primary" 
							          	class='set-btn' 
							          	@click='addDateRange'>
							          	<i class="el-icon-plus"></i>活动日期
							          	</el-button>
							          	<el-button 
							          	type="danger" 
							          	class='set-btn' 
							          	@click='deleteDateRange(index)'>
							          	<i class="el-icon-delete"></i>删除
							          	</el-button>
						          	</div>
				          		</div>
				          		<div 
				          		class="time-range" 
				          		v-for='(time_item,time_index) in item.timelist' 
				          		:key='time_item.index'>
				          	  		<el-time-picker
							    	v-model="time_item.startTime"
							    	:picker-options="{
							      		selectableRange: timeRange
							    	}"
							    	placeholder="起始时间"
							    	style='width:25%'>
							  		</el-time-picker>
								  	<el-time-picker
								    v-model="time_item.endTime"
								    placeholder="结束时间"
								    :picker-options="{
								      selectableRange: timeRange
								    }"
								    style='width:25%'>
								  	</el-time-picker>
							  		<el-input  
							  		style='width:25%' 
							  		ref='partnum' 
							  		v-model='time_item.partnum' 
							  		placeholder='请输入票（券）数量'>	
							  		</el-input>
						   			<span 
						   			class="add-time-range" 
						   			v-show='time_item.backflag == 0 ? true : false' 
						   			@click='handleAddTime(index,time_index)'>
						   				<i class="el-icon-plus"></i>添加时段
						   			</span>
							   		<span 
							   		class="delete"  
							   		@click='handleDeleteTime(index,time_index)'>
							   			<i class="el-icon-delete"></i>
							   		</span>
						   		</div>
					   		</div>
			        	</el-form-item>  
			        
				  		<div class='save'>
				    		<el-button 
				    		type="primary" 
				    		v-show='isEditBtn'  
				    		class='set-btn' 
				    		@click='handleSaveTicket'>
						    	保存
						    </el-button>
				    		<el-button 
				    		v-show='!isEditBtn' 
				    		type="primary"  
				    		class='set-btn' 
				    		@click='handleEditTicket'>修改</el-button>
				    		<el-button 
				    		@click='handleCloseTicket'  
				    		class='set-btn'>取消</el-button>
				  		</div>
					</el-form>
			  	</div>
			</div>
			<div class='result'>
			    <el-button 
			    class='save-btn' 
			    type="primary"  
			    v-loading.fullscreen.lock="oneLoading" 
			    element-loading-text="正在跳转列表页..." 
			    :disabled='SaveDisabledBtn' 
			    @click="submitForm('form')">
					保存
				</el-button>
			</div>
		</el-form>
	</div>
</template>
<script> 
import moment from 'moment'
	export default {
		props:['id','action','isShowInfo','actionTime1','actionTime2','actionDate1','actionDate2'],
		data (){
			return {
				checkedOptions:['姓名','手机号'],
				commonlist:[],
				inputVisible:false,
				inputNameValue:null,
				isEditBtn:true,
				ticketBrn:true,
				limitArr:[],
				limitAll:[],
				buildId:null,
				timeRange:'00:00:00 - 23:59:59',
				confirmBtn:true,
				SaveDisabledBtn:false,
				oneLoading:false,
				priceInfo:null,
				pickerOptions0:{},
				tableCheckedOptions:[],
				pricelist:[{
					status:0,
					name:'免费'
				},{
					status:1,
					name:'收费'
				}],
				form: {
				  name:null,
		          check:null,
		          type: 0,
		          tickettype:0,
		          delivery:false,
		          email:null,
		          comment:false,
		          review:false,
		          ticket:false
		        },
		        limitlist:[],
		        created_form:{},
		        ticketlist: [],
		        input: null,
		        timeinfo:[{}],
        		isShowTicket:false,     
		        rules: {
		          	ticketTitle: [
			            { required: true, message: '请输入您的姓名', trigger: 'blur' },
			            { min: 2, max: 4, message: '长度在 2 到 4 个汉字', trigger: 'blur' }
		          	],
		          	email: [
		          		{ message: '请输入邮箱地址', trigger: 'blur' },
      					{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }
      				]
		        }
			}
		},
		methods:{
			handleClose(index){
				this.tableCheckedOptions.push({
					commonId:this.commonlist[index].id,
		        	key:this.commonlist[index].key,
		        	mustStatus:this.commonlist[index].mustStatus,
		        	infoname:this.commonlist[index].infoname,
		        	sn:this.commonlist[index].sn,
		        	backflag:0
				})
				this.commonlist[index].backflag = 1;
			},

			handleGetTicketType(val){
				this.form.tickettype = val;
			},

			handleGetType(val){
				if (val==1&&this.created_form.limitlist.length==1&&this.ticketBrn==false) {
					this.created_form.limitlist[0].cardtype = this.limitAll[0].cardtype
		      		this.created_form.limitlist[0].cardname = this.limitAll[0].cardname
				}
			},

			handlePriceType(val){
				if (this.created_form.chargeType==0) {
					this.created_form.type=0
				}
			},

			handleInputChangeScore(index){
				if(this.created_form.limitlist[index].score=== '0'){
					this.created_form.limitlist[index].money= 0
				}
			},

			handleInputChangeMoney(index){
				if(this.created_form.limitlist[index].money=== '0'){
					this.created_form.limitlist[index].score= 0
				}
			},

			handleCommentSwitch(val){
				if(val==false){
					this.form.review = false
				}
			},

			handleSwitch(val){
				if(val==true){
					this.form.comment = true
				}
			},

			handleEditTicket(){
		      	this.$confirm('确定要编辑该票么?', '提示', {
		          confirmButtonText: '确定',
		          cancelButtonText: '取消',
		          type: 'info'
	       		}).then(() => {
	       		 	this.EditTicketcontion()
		        }).catch(() => {
		          	this.$message({
			            type: 'info',
			            message: '已取消操作'
		          	});          
		        });
				
			},

			handleScoreSpace(){
		      	for (let i = 0; i < this.created_form.limitlist.length; i++) {
		      		if(this.created_form.limitlist[i].money=='-1'){
						this.created_form.limitlist[i].money= ''
					}
					if(this.created_form.limitlist[i].score=='-1'){
						this.created_form.limitlist[i].score= ''
					}
		      	}
		    },

			EditTicketcontion(){
		      	let ticketFlag = false
		      	let startTimeArr = [];
			    let endTimeArr = [];
			    let starttimeArr = [];
			    let sortArrStart = []
			    let sortArrEnd = []
			    let endtimeArr = [];
			    let number = 0;
			    let startdateFalg = false
			    let enddateFalg = false
			    let endTimeBtn = false
			    let startTimeBtn = false
			    let partBtn = false
			    let chargeType = false
			    let result = 0;
			    let allStartTime =[];
			    let allEndTime = [];
			    let diffPrice = false;
			    for (let j = 0; j < this.created_form.datelist.length; j++) {
			    	startTimeArr.push(new Date(this.created_form.datelist[j].startDate).getTime())
					endTimeArr.push(new Date(this.created_form.datelist[j].endDate).getTime())
				    allStartTime = startTimeArr.sort();
				    allEndTime = endTimeArr.sort();
				    sortArrStart.push([])
				    starttimeArr.push([])
				    endtimeArr.push([])
				    sortArrEnd.push([])
					if(this.created_form.datelist[j].startDate!=undefined&&this.created_form.datelist[j].startDate!=''){
						startdateFalg = true
					}
					if(this.created_form.datelist[j].endDate!=undefined && this.created_form.datelist[j].endDate!=''){
						enddateFalg = true
					}
				    for (let z = 0; z < this.created_form.datelist[j].timelist.length; z++) {
				    	starttimeArr[j].push(this.timeFormat(moment(this.created_form.datelist[j].timelist[z].startTime).format('HH:mm:ss'),1).getTime())
				    	endtimeArr[j].push(this.timeFormat(moment(this.created_form.datelist[j].timelist[z].endTime).format('HH:mm:ss'),1).getTime())
				    	sortArrStart[j] = starttimeArr[j].sort()
				    	sortArrEnd[j] = endtimeArr[j].sort()
				    	if(this.created_form.datelist[j].timelist[z].startTime!=undefined&&this.created_form.datelist[j].timelist[z].startTime!=''){
				    		startTimeBtn = true
				    	}
				    	if(this.created_form.datelist[j].timelist[z].endTime!=undefined&&this.created_form.datelist[j].timelist[z].endTime!=''){
				    		endTimeBtn = true
				    	}
				    	if (this.created_form.datelist[j].timelist[z].partnum!='') {
				    		partBtn = true
				    	}
				    }
			    }

			    for (let i = 0; i < this.created_form.limitlist.length; i++) {
					if(this.created_form.limitlist[i].money===''&&this.created_form.chargeType!=0){
						this.created_form.limitlist[i].money= '-1'
					}
					if(this.created_form.limitlist[i].score===''&&this.created_form.chargeType!=0){
						this.created_form.limitlist[i].score= '-1'
					}
					
					if(this.created_form.limitlist[i].score<0&&this.created_form.limitlist[i].money<0&&this.created_form.chargeType!=0||this.created_form.limitlist[i].score==0&&this.created_form.limitlist[i].money>0&&this.created_form.chargeType!=0||this.created_form.limitlist[i].score>0&&this.created_form.limitlist[i].money==0&&this.created_form.chargeType!=0){
						diffPrice = false;
						chargeType = false;
						if(this.created_form.limitlist[i].money=='-1'){
							this.created_form.limitlist[i].money= ''
						}
						if(this.created_form.limitlist[i].score=='-1'){
							this.created_form.limitlist[i].score= ''
						}
					}else{
						diffPrice = true;
						chargeType = true;
					}

				}

			    for(let k=1;k<allStartTime.length;k++){
			        if (allStartTime[k] <= allEndTime[k-1]){
			        	result+=1;
			        }
			    }
				for (let a = 0; a < sortArrStart.length; a++) {
		    		if(sortArrStart[a].length > 1){
		    			for (var b = 1; b < sortArrStart[a].length; b++) {
			    			if(sortArrStart[a][b]<=sortArrEnd[a][b-1]){
								number+=1;
			    			}
		    			}
		    		}
		    	}
		    	if(this.created_form.ticketTitle!=null){
      			if(this.created_form.chargeType !=null){
  				if(this.created_form.remark !=null){
				if(this.created_form.partmax !=null){
				if(this.created_form.limitlist.length>0){
					if (number > 0) {
						this.$message.error('同一个活动日期内时间段范围重复')
						this.handleScoreSpace()
					}else{
			        if(result > 0){
			        	this.$message.error('同一个票种活动日期范围重复')
			        	this.handleScoreSpace()
			        }else{
			        	if (chargeType) {
				      	if(diffPrice){
					    if(startdateFalg){
						if(enddateFalg){
						if(startTimeBtn){
						if(endTimeBtn){
						if(partBtn){
							this.isShowTicket = false;
							this.isEditBtn = true;
							 
							this.$message({
					            type: 'success',
					            message: '编辑成功!'
					          });
						}else{
							this.$message.error('请输入活动票券数量')
							this.handleScoreSpace()
						}
						}else{
							this.$message.error('请输入结束时间')
							this.handleScoreSpace()
						}

						}else{
							this.$message.error('请输入开始时间')
							this.handleScoreSpace()
						}
						}else{
							this.$message.error('请输入结束日期')
							this.handleScoreSpace()
						}
						}else{
							this.$message.error('请输入起始日期')
							this.handleScoreSpace()
						}
				      	}else{
					      	this.$message.error('积分和费用不符合要求')
					      	this.handleScoreSpace()
				      	}
						}else{
							this.$message.error('积分和费用不符合要求')
							this.handleScoreSpace()
						}
					}
				}
				}else{
					this.$message.error('积分和费用不符合要求')
					this.handleScoreSpace()
				}

				}else{
					this.$message.error('最大次数不能为空')
					this.handleScoreSpace()
				}
  				}else{
  					this.$message.error('票种说明不能为空')
  					this.handleScoreSpace()
  				}

      			}else{
      				this.$message.error('费用类型不能为空')
      				this.handleScoreSpace()
      			}
	      		}else{
	      			this.$message.error('票种名称不能为空')
	      			this.handleScoreSpace()
	      		}
		    },

		    SaveTicketcontion(){
		      	let editFlag =false;
		      	let startTimeArr = [];
			    let endTimeArr = [];
			    let starttimeArr = [];
			    let sortArrStart = []
			    let sortArrEnd = []
			    let endtimeArr = [];
			    let number = 0;
			    let startdateFalg = false;
			    let enddateFalg = false;
			    let endTimeBtn = false;
			    let startTimeBtn = false;
			    let partBtn = false;
			    let chargeType = false;
			    let result = 0;
			    let allStartTime = [];
			    let allEndTime = [];
			    let diffPrice = false;
			    for (let j = 0; j < this.created_form.datelist.length; j++) {
			    	startTimeArr.push(new Date(this.created_form.datelist[j].startDate).getTime())
					endTimeArr.push(new Date(this.created_form.datelist[j].endDate).getTime())
					allStartTime = startTimeArr.sort();
					allEndTime = endTimeArr.sort();
					sortArrStart.push([])
				    starttimeArr.push([])
				    endtimeArr.push([])
				    sortArrEnd.push([])
					if(this.created_form.datelist[j].startDate!=null&&this.created_form.datelist[j].startDate!=''){
						startdateFalg = true
					}
					if(this.created_form.datelist[j].endDate!=null&&this.created_form.datelist[j].endDate!=''){
						enddateFalg = true
					}
				    for (let z = 0; z < this.created_form.datelist[j].timelist.length; z++) {
				    	starttimeArr[j].push(this.timeFormat(moment(this.created_form.datelist[j].timelist[z].startTime).format('HH:mm:ss'),1).getTime())
				    	endtimeArr[j].push(this.timeFormat(moment(this.created_form.datelist[j].timelist[z].endTime).format('HH:mm:ss'),1).getTime())
				    	sortArrStart[j] = starttimeArr[j].sort()
				    	sortArrEnd[j] = endtimeArr[j].sort()
				    	if(this.created_form.datelist[j].timelist[z].startTime!=null&&this.created_form.datelist[j].timelist[z].startTime!=''){
				    		startTimeBtn = true
				    	}
				    	if(this.created_form.datelist[j].timelist[z].endTime!=null&&this.created_form.datelist[j].timelist[z].endTime!=''){
				    		endTimeBtn = true
				    	}
				    	if (this.created_form.datelist[j].timelist[z].partnum!=null&&this.created_form.datelist[j].timelist[z].partnum!='') {
				    		partBtn = true
				    	}
				    }

			    }

			  	for (let i = 0; i < this.created_form.limitlist.length; i++) {

					if(this.created_form.limitlist[i].money===''&&this.created_form.chargeType!=0){
						this.created_form.limitlist[i].money= '-1'
					}
					if(this.created_form.limitlist[i].score===''&&this.created_form.chargeType!=0){
						this.created_form.limitlist[i].score= '-1'
					}
					
					if(this.created_form.limitlist[i].score<0&&this.created_form.limitlist[i].money<0&&this.created_form.chargeType!=0||this.created_form.limitlist[i].score==0&&this.created_form.limitlist[i].money>0&&this.created_form.chargeType!=0||this.created_form.limitlist[i].score>0&&this.created_form.limitlist[i].money==0&&this.created_form.chargeType!=0){
						diffPrice = false;
						chargeType = false;
						if(this.created_form.limitlist[i].money=='-1'){
							this.created_form.limitlist[i].money= ''
						}
						if(this.created_form.limitlist[i].score=='-1'){
							this.created_form.limitlist[i].score= ''
						}
					}else{
						diffPrice = true;
						chargeType = true;
					}
				}
				
			    for(let k=1;k<allStartTime.length;k++){
			        if (allStartTime[k] <= allEndTime[k-1]){
			        	result+=1
			        }
			    }

				for (let a = 0; a < sortArrStart.length; a++) {
		    		if(sortArrStart[a].length > 1){
		    			for (var b = 1; b < sortArrStart[a].length; b++) {
			    			if(sortArrStart[a][b]<=sortArrEnd[a][b-1]){
								number+=1;
			    			}
		    			}
		    		}
		    	}

	      		if(this.created_form.ticketTitle!=null){
      			if(this.created_form.chargeType !=null){
  				if(this.created_form.remark !=null){
				if(this.created_form.partmax !=null){
				if(this.created_form.limitlist.length>0){
					if (number > 0) {
						this.$message.error('同一个活动日期内时间段范围重复')
						this.handleScoreSpace()
					}else{
			        if(result > 0){
			        	this.$message.error('同一个票种活动日期范围重复')
			        	this.handleScoreSpace()
			        }else{
			        	if (chargeType) {
			        	if (diffPrice) {
				       	if(startdateFalg){
						if(enddateFalg){
						if(startTimeBtn){
						if(endTimeBtn){
						if(partBtn){
							this.ticketlist.push(this.created_form)
							this.isShowTicket = false;
							this.$message({
					            type: 'success',
					            message: '添加成功!'
					          });
						}else{
							this.$message.error('请输入活动票券数量')
							this.handleScoreSpace()
						}
						}else{
							this.$message.error('请输入结束时间')
							this.handleScoreSpace()
						}

						}else{
							this.$message.error('请输入开始时间')
							this.handleScoreSpace()
						}
						}else{
							this.$message.error('请输入结束日期')
							this.handleScoreSpace()
						}
						}else{
							this.$message.error('请输入起始日期')
							this.handleScoreSpace()
						}
			        	}else{
			        		this.$message.error('积分和费用不符合要求')
			        		this.handleScoreSpace()
			        	}
						}else{
							this.$message.error('积分和费用不符合要求')
							this.handleScoreSpace()
						}
					}
				}
			
				}else{
					this.$message.error('积分和费用不符合要求')
					this.handleScoreSpace()
				}

				}else{
					this.$message.error('最大次数不能为空')
					this.handleScoreSpace()
				}
  				}else{
  					this.$message.error('票种说明不能为空')
  					this.handleScoreSpace()
  				}

      			}else{
      				this.$message.error('费用类型不能为空')
      				this.handleScoreSpace()
      			}
	      		}else{
	      			this.$message.error('票种名称不能为空')
	      			this.handleScoreSpace()
	      		}
		    },

			handleBtnSelf(){
				this.inputVisible = !this.inputVisible;
			},

			getCardType($index,$event){
				for (var i = 0; i < this.limitAll.length; i++) {
					if(this.limitAll[i].cardname == $event){
						 this.created_form.limitlist[$index].cardtype = this.limitAll[i].cardtype
						 this.created_form.limitlist[$index].cardname = this.limitAll[i].cardname
					}
				}
			},

			getCommonInfo() {
                this.$http.post(
              	'marketweb/actioncommon/queryCommons',{
              		keyAdmin:this.$store.state.keyAdmin
              	}).then(response => {
              	if(response.body.code ==200){
              		this.commonlist = response.body.commonlist
              		this.getDefaultSelected()
              		this.handleChangeData()
          		}else{
          			this.$message.error(response.body.msg)
          		}
               
                }, response => {
                    this.$message.error("获取公用数据失败");
                })
            },

			handleDeleteTableData(index){
				this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
			        confirmButtonText: '确定',
			        cancelButtonText: '取消',
			        type: 'warning'
		        }).then(() => {
		          	this.ticketlist.splice(index,1)
		          	this.$message({
			            type: 'success',
			            message: '删除成功!'
		          	});
		        }).catch(() => {
		          	this.$message({
			            type: 'info',
			            message: '已取消删除'
		          	});          
		        });
			},

			addDateRange(){
				this.created_form.datelist.push({
	        		startDate:null,
	        		endDate:null,
	        		timelist:[{
	        			startTime:null,
	        			endTime:null,
	        			partnum:null,
	        			ordernumner:null,
	        			backflag:0
	        		}]
		        })
			},

			handleAddTime(index,time_index){
				for (var i = 0; i <= time_index; i++) {
					this.created_form.datelist[index].timelist[i].backflag = 1
				}
				this.created_form.datelist[index].timelist.push(
					{
	        			startTime:null,
	        			endTime:null,
	        			partnum:null,
	        			ordernumner:null,
	        			backflag:0
	        		}
	        	)	
			},

			getCard(){
				this.$http.post('marketweb/actionback/queryMembers',{
					keyAdmin:this.$store.state.keyAdmin
				}).then(response=>{
					if(response.body.code ==200){
						this.limitAll = response.body.limitlist;
					}else{
						this.$message.error(response.body.msg)
					}
				},response=>{
					this.$message.error('获取卡类型列表失败')
				})
			},

			handleGetDelivery(val){
				if(val==1){
					this.form.delivery = true
				}else{
					this.form.delivery = false
				}
			},

			PostData(){
				 for (var i = 0; i < this.tableCheckedOptions.length; i++) {
					if (this.tableCheckedOptions[i].mustStatus==true) {
						this.tableCheckedOptions[i].mustStatus = 1
					}else{
						this.tableCheckedOptions[i].mustStatus = 0
					}
				}
				for (var z = 0; z < this.ticketlist.length; z++) {
					if((this.ticketlist[z].chargeType==1&&this.form.type == 0) || (this.form.type == 1&&this.ticketlist[z].chargeType==1&&this.ticketlist[z].type==0)){
						this.ticketlist[z].limitlist = this.ticketlist[z].limitlist.slice(-1)
						this.ticketlist[z].limitlist[0].cardtype = 'ALL'
			      		this.ticketlist[z].limitlist[0].cardname = '全部'
			      	}
			      	if(this.ticketlist[z].chargeType==0){
			      		this.ticketlist[z].limitlist[0].score = '0'
			      		this.ticketlist[z].limitlist[0].money = '0'
			      	}
					for (var i = 0; i < this.ticketlist[z].datelist.length; i++) {
			      		this.ticketlist[z].datelist[i].startDate = moment(this.ticketlist[z].datelist[i].startDate).format('YYYY-MM-DD')
			      		this.ticketlist[z].datelist[i].endDate = moment(this.ticketlist[z].datelist[i].endDate).format('YYYY-MM-DD')
						for (var j = 0; j < this.ticketlist[z].datelist[i].timelist.length; j++) {
							this.ticketlist[z].datelist[i].timelist[j].startTime =moment(this.ticketlist[z].datelist[i].timelist[j].startTime).format('HH:mm:ss')
							this.ticketlist[z].datelist[i].timelist[j].endTime =moment(this.ticketlist[z].datelist[i].timelist[j].endTime).format('HH:mm:ss')
						}
					}
				}
				this.oneLoading = true
				this.$http.post('marketweb/actionback/updateconf',{
					keyAdmin:this.$store.state.keyAdmin,
					type:this.form.type,
					enrollStatus:this.form.delivery ? 1 : 0,
					commentStatus: this.form.comment ? 1 : 0,
					commentAudit: this.form.review ? 1 : 0,
					tickettype:this.form.tickettype,
					infolistStr: JSON.stringify(this.tableCheckedOptions),
					ticketlistStr: JSON.stringify(this.ticketlist),
					id:this.id
				}).then(response=>{
					if (response.body.code == '200') {
						let self = this;
						this.$emit('next',response.body.id)
						this.$message({
		                  message:'新建配置信息成功',
		                  type:'success'
		                })

		                this.SaveDisabledBtn = true;
				        setTimeout(function(){
				        	self.$router.push('/')
				            this.oneLoading = false
				        },1000);
					}else{
						this.oneLoading = false
						this.$message.error(response.body.msg)
						for (var z = 0; z < this.ticketlist.length; z++) {
							for (var i = 0; i < this.ticketlist[z].datelist.length; i++) {
			      				this.ticketlist[z].datelist[i].startDate = new Date(this.ticketlist[z].datelist[i].startDate)
			      				this.ticketlist[z].datelist[i].endDate = new Date(this.ticketlist[z].datelist[i].endDate)
								for (var j = 0; j < this.ticketlist[z].datelist[i].timelist.length; j++) {
									this.ticketlist[z].datelist[i].timelist[j].startTime =this.timeFormat(this.ticketlist[z].datelist[i].timelist[j].startTime,1)
									this.ticketlist[z].datelist[i].timelist[j].endTime =this.timeFormat(this.ticketlist[z].datelist[i].timelist[j].endTime,1)
								}
							}
						}
						for (var i = 0; i < this.tableCheckedOptions.length; i++) {
							if (this.tableCheckedOptions[i].mustStatus==1) {
								this.tableCheckedOptions[i].mustStatus = true
							}else{
								this.tableCheckedOptions[i].mustStatus = false
							}
						}
					}	
				},response=>{
					this.oneLoading = false
					this.$message.error('新建信息保存失败')
				})
			},

			updateData(){
				this.$confirm('您将新建活动配置信息, 是否继续?', '提示', {
		          	confirmButtonText: '确定',
		          	cancelButtonText: '取消',
		          	type: 'info'
		        }).then(() => {	
		          	this.PostData()
		        }).catch(() => {
		          	this.$message({
			            type: 'info',
			            message: '已取消操作'
		          	});          
		        });
			},

			submitForm() {
				if(this.form.delivery == false){
					this.updateData()
				}else if(this.form.delivery == true && this.ticketlist.length && this.isShowTicket == false){
					this.updateData()
				}else if(this.form.delivery == true && this.ticketlist.length && this.isShowTicket!=false){
					this.$message.error('请先保存您的票券信息！')
				}else{
					this.$message.error('请添加至少一张购票劵')
				}	
		    },

		    deleteRow($index, tableCheckedOptions){
		      	for (var i = 0; i < this.commonlist.length; i++) {
		      		if(this.commonlist[i].infoname == tableCheckedOptions[$index].infoname){
		      			this.commonlist[i].backflag = 0;
		      		}
		      	}
		      	this.tableCheckedOptions.splice($index,1)
		    },

		    handleTicketType(){
		      	this.isShowTicket = true;
		      	this.isEditBtn = true;
		      	this.created_form = {
		        	chargeType:0,
		        	partmax:null,
		        	remark:null,
		        	auditStatus:0,
		        	ticketTitle:null,
		        	remark:null,
		        	type:0,
		        	limitlist:[{
		        		cardtype:'ALL',
		        		cardname:'全部',
		        		backflag:0,
		        		money:'',
		        		score:''
		        	}],
		        	datelist:[{
		        		startDate:null,
		        		endDate:null,
		        		backflag:0 ,
		        		timelist:[{
		        			startTime:null,
		        			endTime:null,
		        			partnum:null,
		        			ordernumner:null,
		        			backflag:0
		        		}]
		        	}]
    		    }
		        this.created_form.limitlist[0].cardname = this.limitAll[0].cardname
		        this.created_form.limitlist[0].cardtype = this.limitAll[0].cardtype
		    },

		    handleEdit($index, row){
		      	this.isShowTicket = true;
		      	this.isEditBtn = false;
		      	this.created_form = {
		        	chargeType:0,
		        	partmax:null,
		        	remark:null,
		        	auditStatus:0,
		        	ticketTitle:null,
		        	remark:null,
		        	type:0,
		        	limitlist:[],
		        	datelist:[{
		        		startDate:null,
		        		endDate:null,
		        		backflag:0 ,
		        		timelist:[{
		        			startTime:null,
		        			endTime:null,
		        			partnum:null,
		        			ordernumner:null,
		        			backflag:0
		        		}]
		        	}]
    		    }
		      	this.created_form = this.ticketlist[$index]
	      	  	for (let i = 0; i < this.created_form.limitlist.length; i++) {
		      	  	if(this.created_form.limitlist[i].money<0){
						this.created_form.limitlist[i].money= ''
					}else{
						this.created_form.limitlist[i].money= this.created_form.limitlist[i].money
					}
					if(this.created_form.limitlist[i].score<0){
						this.created_form.limitlist[i].score= ''
					}else{
						this.created_form.limitlist[i].score= this.created_form.limitlist[i].score
					}
	      	  	}
		    },

 			timeFormat(date,i){
		        if(i=1){
		          date= '2017-12-12 '+date;
		        } 
		        var t=Date.parse(date) 
		        if (!isNaN(t)) {  
		            return new Date(Date.parse(date.replace(/-/g, "/")));  
		        } else {  
		            return new Date();  
		        }  

		    },
		    confrimBtn(){
		      	let btnFlag = false
		      	const arr=[]
		      	if(this.inputNameValue == ''||this.inputNameValue == null){
		      		this.$message.error('添加字段不能为空')
			    }else{
				    for (let i = 0; i < this.commonlist.length; i++) {
			      		arr.push(this.commonlist[i].infoname)
			      		if(arr.indexOf(this.inputNameValue)==-1){
			      			btnFlag = true
			      		}else{
			      			btnFlag = false
			      		}
			      	}
			      	if(btnFlag == true){
			      		this.commonlist.push({
				      	 	infoname:this.inputNameValue,
				      	 	key:' '
				      	})
				      	this.inputNameValue = ''
			      	}else{
			      		this.$message.error('已存在相同字段！')
			      	}
			    }
		      	
		    },
		    getDefaultSelected(){
				for (var i = 0; i < this.commonlist.length; i++) {
					if(this.commonlist[i].status == 1){
						this.tableCheckedOptions.push({
							commonId:this.commonlist[i].id,
				        	key:this.commonlist[i].key,
				        	infoname:this.commonlist[i].infoname,
				        	mustStatus:true,
				        	sn:this.commonlist[i].sn,
				        	backflag:0
						})
					}
				}
			},

		    handleDeleteTime(index,time_index){
		      	let time = this.created_form.datelist
		      	if(time[index].timelist.length >1){
		      		if(time_index == time[index].timelist.length-1){
			      	  	let end_num = time[index].timelist.length-2
			      	  	time[index].timelist[end_num].backflag = 0
		      	  	}
		      	  	time[index].timelist.splice(time_index,1)
		      	}else{
		      		this.$message.error('不能再删除')
		      	} 
		    },

		    deleteDateRange(index){
		      	if (this.created_form.datelist.length>1) {
		      		this.created_form.datelist.splice(index,1)
		      	}else{
		      		this.$message.error('不能再删除')
		      	}
		    },

		    handleDeleteTableRow(index){
		      	this.ticketlist.splice(index,1)
		    },

		    handleSaveTicket(){
		      	this.$confirm('确定要添加该票么?', '提示', {
		          	confirmButtonText: '确定',
		          	cancelButtonText: '取消',
		          	type: 'info'
	       		}).then(() => {
	       		 	this.SaveTicketcontion()
			    }).catch(() => {
			        this.$message({
			            type: 'info',
			            message: '已取消操作'
			        });          
			    });
		    },

		    handleCloseTicket(){
		      	this.$confirm('确定要取消保存么?', '提示', {
		          	confirmButtonText: '确定',
		          	cancelButtonText: '取消',
		          	type: 'warning'
		        }).then(() => {
		          	this.$message({
			            type: 'success',
			            message: '取消成功!'
		          	});
		          	this.isShowTicket = false;
		      	  	this.isEditBtn = true;
		        }).catch(() => {
		          	this.$message({
			            type: 'info',
			            message: '已取消操作'
		          	});          
		        });
		      	
		    },

		    addDiscount($event,index){
		      	if(this.created_form.limitlist.length<this.limitAll.length){
		      		for (var i = 0; i <= index; i++) {
			        	this.created_form.limitlist[i].backflag = 1;
			        }
			        this.created_form.limitlist.push({
			        	cardtype:this.limitlist[0].cardtype,
		        		cardname:this.limitlist[0].cardname,
		        		backflag:0,
		        		money:'',
		        		score:''
			        })  
		      	}else{
		      		this.$message.error('添加尊享会员超过限制')
		      	}
		        
		    },

		    reduceDiscount($event,index){
		      	this.created_form.limitlist.splice(index,1)
		    },

		    resetForm(formName) {
		        this.$refs[formName].resetFields();
		    },
		      //编辑情况
		    handleChangeData(){	
                this.form.type = this.action.type ? this.action.type : 0;
                this.buildId = this.action.buildIdStr;
                this.form.comment = this.action.commentStatus == 1 ? true : false;
                this.form.tickettype = this.action.tickettype;
                this.form.review = this.action.commentAudit == 1 ? true : false;
                this.form.delivery = this.action.enrollStatus == 1 ? true : false;
                this.tableCheckedOptions = this.action.infolist.length ? this.action.infolist : this.tableCheckedOptions;
	            for (var i = 0; i < this.tableCheckedOptions.length; i++) {
                	if(this.tableCheckedOptions[i].mustStatus == 1){
                		this.tableCheckedOptions[i].mustStatus = true
                	}else{
                		this.tableCheckedOptions[i].mustStatus = false
                	}
            	}
                for (var i = 0; i < this.commonlist.length; i++) {
                	for (var j = 0; j < this.tableCheckedOptions.length; j++) {
                		if(this.tableCheckedOptions[j].infoname == this.commonlist[i].infoname){
                			this.commonlist[i].backflag = 1
                		}
                	}
           		 }
	             this.ticketlist = this.action.ticketlist;
                for (var z = 0; z < this.ticketlist.length; z++) {
                	if((this.ticketlist[z].chargeType==1&&this.form.type == 0) || (this.form.type == 1&&this.ticketlist[z].chargeType==1&&this.ticketlist[z].type==0)){
            			this.ticketBrn = false;
						this.ticketlist[z].limitlist[0].cardtype = this.limitAll[0].cardtype
			      		this.ticketlist[z].limitlist[0].cardname = this.limitAll[0].cardname
			      	}
                	for (var a = 0; a < this.ticketlist[z].limitlist.length; a++) {
                		this.ticketlist[z].limitlist[a].backflag = 1
                		this.ticketlist[z].limitlist[this.ticketlist[z].limitlist.length-1].backflag = 0
                	}
					for (var i = 0; i < this.ticketlist[z].datelist.length; i++) {
			      		this.ticketlist[z].datelist[i].startDate = new Date(this.ticketlist[z].datelist[i].startDate)
			      		this.ticketlist[z].datelist[i].endDate = new Date(this.ticketlist[z].datelist[i].endDate)
			      		this.ticketlist[z].datelist[i].backflag = 1;
			      		this.ticketlist[z].datelist[this.ticketlist[z].datelist.length-1].backflag=0
						for (var j = 0; j < this.ticketlist[z].datelist[i].timelist.length; j++) {
							this.ticketlist[z].datelist[i].timelist[j].startTime =this.timeFormat(this.ticketlist[z].datelist[i].timelist[j].startTime,1)
							this.ticketlist[z].datelist[i].timelist[j].endTime =this.timeFormat(this.ticketlist[z].datelist[i].timelist[j].endTime,1)
							this.ticketlist[z].datelist[i].timelist[j].backflag = 1;
							this.ticketlist[z].datelist[i].timelist[this.ticketlist[z].datelist[i].timelist.length-1].backflag = 0;
						}
				  	}
				}
		    }
		},

		computed:{
			createdss(){
				if (this.created_form.chargeType==0) {
					this.created_form.limitlist = this.created_form.limitlist.slice(-1)
					this.created_form.type=0
					this.created_form.limitlist[0].cardtype = 'ALL'
			      	this.created_form.limitlist[0].cardname = '全部'
				}
				if(this.created_form.type==1&&this.created_form.chargeType!=0){
					var len = this.created_form.limitlist.length
					this.ticketBrn = false;
						if(len>=this.limitAll.length){
							this.limitlist = []
						}else{
							for (var i = 0; i < len; i++) {
					        	this.limitArr.push(this.created_form.limitlist[i])
					        }
			       			var arr = [];
				      		for (let i = 0; i < this.limitAll.length; i++) {
				      			var stra=this.limitAll[i];
	   							var count=0;
				      			for (let j = 0; j < this.limitArr.length; j++) {
				      				var strb=this.limitArr[j];
				      				if(strb.cardname==stra.cardname){
				      					 count++
				      				}
				      			}
				      			if(count==0){
								    arr.push(stra)
								    this.limitlist = arr
								}
				      		}
			      		 this.limitArr = []
			      		
			      	}
				}

		      	return this.created_form
			}
		},

		watch:{
			isShowInfo(newData,old){
				if(newData == false){
					this.timeRange = this.actionTime1 +' - '+ this.actionTime2
					var oThat = this
					this.pickerOptions0 = {
						disabledDate(time) {
				            return time.getTime() < new Date(oThat.actionDate1)- 8.64e7 || time.getTime() >= new Date(oThat.actionDate2);
				        }
					}
				}
			},

			createdss(newb,oldb){
				this.created_form = newb
			}

		},

		mounted(){
			this.getCard()
			this.getCommonInfo()
		}
	}
</script>
<style scoped>
	.activity-type{
		margin-top: 50px;
		padding: 5px 0;
	}
	.el-form-item{
		margin-bottom: 10px;
	}
	.form-item{
		background: #eee;
		padding: 10px 6px;
		margin-bottom: 10px;	
	}
	.el-radio{
		padding: 0 15px;
	}
	.input-new-tag{
		width: 30%;
	}
	.form-ticket-type{
		margin-left: -120px;

	}
	.is-entry{
		margin: 0 15px;
	}
	.person-info{
		margin-left: -72px;
	}
	.tag-name{
		margin:4px 6px;
		padding:4px;
	}
	.info{
		background: #eee;
		padding-top: 0;
		padding-bottom: 20px;
		margin: 0 ;
	}
	.el-radio-choose{
		margin-top: 10px;
	}
	.showInformation{
		margin-bottom: 10px;
		position: relative;
	}
	.ticket-info{
		background: #eee;
		padding: 10px 20px;
	}
	.self-input{
		width: 120px;
	}
	.el-input{
		width: 240px;
		height: 30px;
	}
	.date-range{
		display: flex;
		margin-top: 10px;
		justify-content: space-between;
	}
	.date-range-item{
		margin-right: 10px;
	}
	.person-info{
		line-height: 1;
		padding-top: 10px;
	}
	.custom-reduce{
		position: relative;
	}
	.reduce-money{
		width: 150px;
	}
	.self-btn{
		padding: 4px 6px;
		margin-left: 10px;
	}
	.normal-field{
		background: #fff;
		padding: 10px;
		position: relative;
		margin-top: 10px;
		margin-bottom: 20px;
		width: 90%;
		border:1px dashed #aaa;
	}
	.type-container{
		background: #fff;
		padding: 0;
		padding-top: 15px;
	}
	.save{
		text-align: center;
		margin-left: -50px;

	}
	.confirm-btn{
		padding: 8px 8px;
	}
	.often-use{
		position: absolute;
		top: 2px;
		left: 50%;
		z-index: 2;
		transform: translateX(-50%);
	}
	.el-checkbox__input{
		font-size: 20px;
		width: 14px;
		height: 15px;
	}
	.set-btn{
		padding: 8px 10px;
	}
	.first-name{
		margin-left: 15px;
	}
	.el-checkbox{
		padding: 0 5px;
		line-height: 20px;
	}
	.custom-field{
		width: 120px;
		height: 30px;
	}
	.custom-field-btn{
		
	}
	.el-input .el-input__inner{
		padding: 0;
	}
	.el-form-item__content{
		line-height: 1;
	}
	.change-num{
		position: absolute;
		cursor: pointer;
		right: -40px;
		color: #666;
		z-index: 2;
		top: 10px;
	}
	.el-switch{
		margin-top: 8px;
	}
	.comment{
		margin-bottom:0;
		margin-top:10px;
	}
	.table-btn{
		display: inline-block;
		float: left;
	}
	.new-ticket{
		margin:10px 0 10px 120px;
	}
	.save-btn{
		width: 80px;
		height: 40px;
	}
	.build-tickt-title{
		background: #ddd;
		padding: 10px;
		box-shadow: 0 0 1px #000;
		font-size: 14px;
	}
	.normal-reduce{
		margin: 10px 0;
		font-size: 12px;
	}
	.normal-reduce span{
		padding: 0 10px;
	}
	.normal-reduce em{
		display: block;
	}
	.result{
	 text-align: center;
	 margin: 10px auto;
	}
	.time-range{
		margin-top: 10px;
		position: relative;
	}
	.delete{
		position:absolute;
		right: 20px;
		cursor: pointer;
		font-size: 24px;
	}
	.add-time-range{
		position: absolute;;
		right: 50px;
		cursor: pointer;
	}
	.delete-activity-date{
		font-size: 30px;
		padding: 0 20px;
	}
</style>